#import "CalculatorModel.h"


@implementation CalculatorModel

@synthesize pCount;
@synthesize nCount;
@synthesize dCount;
@synthesize qCount;
@synthesize lCount;
@synthesize tCount;
@synthesize totalValue;
@synthesize randomNumber;

//sdfsa

-(int)addPenny
{
	pCount=pCount+1;
	return  pCount;
}

-(int)decPenny;
{
	
	if(pCount>0)
	{pCount=pCount-1;
	return  pCount;}
	else
	{
		return 0;
	}
}

-(int)getPenny
{
	return  pCount;
}

-(int)addNickel;
{
	nCount=nCount+1;
	return  nCount;
}

-(int)decNickel;
{
	
	if(nCount>0)
	{nCount=nCount-1;
	return  nCount;}
	else
	{
		return 0;
	}
}

-(int)getNickel;
{
	
	return  nCount;
}

-(int)addDime;
{
	dCount=dCount+1;
	return  dCount;
}

-(int)decDime;
{
	
	if(dCount>0)
	{dCount=dCount-1;
	return  dCount;}
	else
	{
		return 0;
	}
}

-(int)getDime;
{
	
	return  dCount;
}

-(int)addQuater;
{
	qCount=qCount+1;
	return  qCount;
}

-(int)decQuater;
{
	
	if(qCount>0)
	{qCount=qCount-1;
	return  qCount;}
	else
	{
		return 0;
	}
}

-(int)getQuater;
{
	
	return  qCount;
}

-(int)addLoonie;
{
	lCount=lCount+1;
	return  lCount;
}

-(int)decLoonie;
{
	
	if(lCount>0)
	{lCount=lCount-1;
	return  lCount;}
	else
	{
		return 0;
	}
}

-(int)getLoonie;
{
	
	return  lCount;
}


-(int)addToonie;
{
	tCount=tCount+1;
	return  tCount;
}

-(int)decToonie;
{
	
	if(tCount>0)
	{tCount=tCount-1;
	return  tCount;}
	else
	{
		return 0;
	}
}

-(int)getToonie;
{
	
	return  tCount;
}

-(float)total;
{
	totalValue=(pCount*0.01+nCount*0.05+dCount*0.1+qCount*0.25+lCount+tCount*2);
	
	
	
	if(randomNumber==0)
	{
		return -2;
	}
	else if(totalValue==randomNumber)
	{
		return -1;
	}
	else
	{
		return  totalValue;
	}
	
}

-(float)randomValue;
{
	float value1;
	value1 =arc4random() %100;
	randomNumber=value1/100;
	value1 =arc4random() %10;
	randomNumber=value1+randomNumber;
	
	pCount = 0;
	nCount = 0;
	dCount = 0;
	qCount = 0;
	lCount = 0;
	tCount = 0;
	
	return randomNumber;
}


-init
{
	/*
	pCount = 0;
	nCount = 0;
	dCount = 0;
	qCount = 0;
	lCount = 0;
	tCount = 0;
	totalValue=0;
	randomNumber=0;
*/
	 return self;

}

-(void)dealloc
{
	
	[super dealloc];
}


@end
